package com.ansion.commonchat.dao;


import android.content.Intent;
import android.text.TextUtils;

import com.ansion.basedb.dao.model.GroupModel;
import com.ansion.basedb.dao.model.UserModel;
import com.ansion.constant.BConstant;
import com.ansion.utils.ApplicationHelper;

import java.io.Serializable;
import java.util.List;

public class CocoDaoBroadcastUtil {

	public static final String KEY_MESSAGEMODEL = "MESSAGE";
	public static final String KEY_SESSIONID = "SESSIONID";

	public static final String KEY_COCOPUBLICMODEL = "COCOPUBLICMODEL";
	public static final String KEY_MODEL = "KEY_MODEL";
	public static final String KEY_MODELLIST = "KEY_MODELLIST";

	public static final String kDAOCategory_BatchAdd = "kDAOCategory_BatchAdd";
	public static final String kDAOCategory_RowReplace = "kDAOCategory_RowReplace";
	public static final String kDAOCategory_RowRemove = "kDAOCategory_RowRemove";
	public static final String kDAOCategory_RowProgress = "kDAOCategory_RowProgress";
	public static final String kDAOCategory_RowInsert = "kDAOCategory_RowInsert";
	public static final String kDAOCategory_ClearSession = "kDAOCategory_CleaerSession";
	public static final String kDAOCategory_LoadEnd = "kDAOCategory_LoadEnd";
	public static final String kDAOAction_ContactsTable = "kDAOAction_ContactsTable";
	public static final String kDAOAction_SessionTable = "kDAOAction_SessionTable";
	// message table 消息表
	public static final String kDAOAction_ChatMessageTable = "kDAOAction_ChatMessageTable";
	// GroupInfo表
	public static final String kDAOAction_GroupTable = "kDAOAction_GroupTable";
	// GroupNearbyInfo表
	public static final String kDAOAction_GroupNearbyTable = "kDAOAction_GroupNearbyTable";
	public static final String kDAOAction_SyncGroups = "kDAOAction_SyncGroups";
	public static final String kDAOAction_FriendTable = "kDAOAction_FriendTable";
	public static final String kDAOAction_UserTable = "kDAOAction_UserTable";
	public static final String kDAOAction_BlockModel ="kDAOAction_BlockModel";
	public static final String kDAOAction_PermissionModel ="kDAOAction_PermissionModel";
	public static final String kDAOAction_LastSeenModel = "kDAOAction_LastSeenModel";


	public static final String kDAOAction_SilentModelBatch = "kDAOAction_SilentModelBatch";
	public static final String kDAOAction_UserTableBatch = "kDAOAction_UserTableBatch";
	public static final String kDAOAction_BlockModelBatch ="kDAOAction_BlockModelBatch";
	public static final String kDAOAction_SystemCallAndSmsModel = "kDAOAction_SystemCallAndSmsModel";

	public static final String kDAOAction_UpdateGroupName = "kDAOAction_UpdateGroupName";
	public static final String kDAOAction_PeoplesNearbyTable = "kDAOAction_PeoplesNearbyTable";
	public static final String ACTION_WAKELOCK = "action_wakeLock";

	//通过链接加入群成功后，finish前面的页面。
	public static final String ACTION_FINISH_INVITEGROUPACTIVITY = "ACTION_FINISH_INVITEGROUPACTIVITY";

	//删除favgroup
	public static final String ACTION_DELETE_FAVGROUP = "ACTION_DELETE_FAVGROUP";

	//公共账号
	public static final String kDAOAction_CocoPublicTable = "kDAOAction_CocoPublicTable";

	public static final String kDAOAction_BackgroundImageModel = "kDAOAction_BackgroundImageModel";

	public static final String ACTION_CALLLOGSTATE_CHANGED = "ACTION_CALLSTATE_CHANGED";

	public static final String ACTION_APK_DOWNLOADED_SUCCESS = "ACTION_APK_DOWNLOADED_SUCCESS";

	public static final String ACTION_CLEAR_UPDATE_TIP = "ACTION_CLEAR_UPDATE_TIP";

	public static final String ACTION_VERSION_UPDATE_PROGRESS = "ACTION_VERSION_UPDATE_PROGRESS";

	public static final String ACTION_RECORD_AUDIO = "ACTION_RECORD_AUDIO";
	public static final String ACTION_CAPTURE_VIDEO = "ACTION_CAPTURE_VIDEO";
	public static final String ACTION_TAKE_PHOTO_MESSAGE = "ACTION_TAKE_PHOTO_MESSAGE";
	public static final String ACTION_TAKE_PROFILE_PICTURE = "ACTION_TAKE_PROFILE_PICTURE";
	public static final String ACTION_TAKE_CHAT_BACKGROUND = "ACTION_TAKE_CHAT_BACKGROUND";

//	/**
//	 * 消息表数据变化，发送广播通知
//	 * @param category
//	 * @param msgModel
//	 */
//	public static void sendChatMessageModelChangIntent(String category, ChatMessageModel msgModel) {
//		if (!TextUtils.isEmpty(category) && msgModel != null) {
//			Intent intent = new Intent(kDAOAction_ChatMessageTable);
//			intent.addCategory(category);
//			intent.putExtra(KEY_MESSAGEMODEL, msgModel);
//			LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//		}
//	}
//
//    /**
//     * 消息表数据批量变化，发送广播通知
//     * @param category
//     * @param msgList 批量的消息数据
//     */
//    public static void sendChatMessageModelChangIntent(String category, List<ChatMessageModel> msgList) {
//        if (!TextUtils.isEmpty(category) && msgList != null && msgList.size() > 0) {
//            Intent intent = new Intent(kDAOAction_ChatMessageTable);
//            intent.addCategory(category);
//            intent.putExtra(KEY_MODELLIST, (Serializable) msgList);
//            LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//                    .sendBroadcast(intent);
//        }
//    }
//
//	public static void sendChatMessageModelChangIntent(String category) {
//		Intent intent = new Intent(kDAOAction_ChatMessageTable);
//		intent.addCategory(category);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//    public static void sendClearSessionIntent(String sessionId) {
//		if (!TextUtils.isEmpty(sessionId)) {
//			Intent intent = new Intent(kDAOAction_ChatMessageTable);
//			intent.addCategory(kDAOCategory_ClearSession);
//			intent.putExtra(KEY_SESSIONID, sessionId);
//			LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//					.sendBroadcast(intent);
//		}
//	}
//
//    public static void sendSessionModelChangIntent(String category, SessionModel sessionModel) {
//        if (!TextUtils.isEmpty(category) && sessionModel != null) {
//            Intent intent = new Intent(kDAOAction_SessionTable);
//            intent.addCategory(category);
//            intent.putExtra("session", sessionModel);
//            LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//                    .sendBroadcast(intent);
//        }
//    }
//
//	/**
//	 * 单个UserModel
//	 * @param category
//	 * @param user
//	 */
//	public static void sendUserModelChangeIntent(String category, UserModel user){
//		Intent intent = new Intent(kDAOAction_UserTable);
//		intent.addCategory(category);
//		intent.putExtra("user", user);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//			.sendBroadcast(intent);
//	}
//
//	/**
//	 * 单个UserModel
//	 * @param category
//	 * @param user
//	 */
//	public static final String KEY_USERMODELCHANGEINTENTEXTRA = "fromMessage";
//	public static void sendUserModelChangeIntentFromMessage(String category, UserModel user){
//		Intent intent = new Intent(kDAOAction_UserTable);
//		intent.addCategory(category);
//		intent.putExtra(KEY_USERMODELCHANGEINTENTEXTRA, true);
//		intent.putExtra("user", user);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//			.sendBroadcast(intent);
//	}
//
//	/**
//	 * 单个BlockModel数据改变
//	 * @param category
//	 * @param block
//	 */
//	public static void sendBlockModelChangeIntent(String category, BlockModel block){
//		Intent intent = new Intent(kDAOAction_BlockModel);
//		intent.addCategory(category);
//		intent.putExtra(KEY_MODEL, block);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//			.sendBroadcast(intent);
//	}
//
//	/**
//	 * 批量UserModel数据改变
//	 * @param category
//	 * @param userList
//	 */
//	public static void sendUserModelBatchChangeIntent(String category, List<UserModel> userList){
//		Intent intent = new Intent(kDAOAction_UserTableBatch);
//		intent.addCategory(category);
//		intent.putExtra("userList", (Serializable)userList);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//			.sendBroadcast(intent);
//	}
//
//	/**
//	 * 批量BlockModel数据改变
//	 * @param category
//	 * @param blockList
//	 */
//	public static void sendBlockModelBatchChangeIntent(String category, List<BlockModel> blockList){
//		Intent intent = new Intent(kDAOAction_UserTableBatch);
//		intent.addCategory(category);
//		intent.putExtra("blockList", (Serializable)blockList);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//			.sendBroadcast(intent);
//	}
//
//	/**
//	 * group改变
//	 * @param category
//	 * @param groupModel
//	 */
//	public static void sendGroupChangeIntent(String category , GroupModel groupModel){
//
//		Intent intent = new Intent(kDAOAction_GroupTable);
//		intent.addCategory(category);
//		intent.putExtra("group", groupModel);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//			.sendBroadcast(intent);
//	}
//
//	public static void sendGroupChangeIntent(String category , List<GroupModel> groupList){
//
//		Intent intent = new Intent(kDAOAction_SyncGroups);
//		intent.addCategory(category);
//		intent.putExtra("groupList", (Serializable)groupList);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//			.sendBroadcast(intent);
//	}
//
//	public static void sendCallLogReplaceIntent(CallLogModel callLogModel){
//
//		Intent intent = new Intent(kDAOAction_CallLogTable);
//		intent.addCategory(kDAOCategory_RowReplace );
//		intent.putExtra("callLog", callLogModel);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//
//
//	public static void sendCallLogReplaceIntent(List<CallLogModel> callLogList){
//
//		Intent intent = new Intent(kDAOAction_CallLogTable);
//		intent.addCategory(kDAOCategory_RowReplace );
//		intent.putExtra("callLogList", (Serializable)callLogList);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendCallLogRemoveIntent(){
//
//		Intent intent = new Intent(kDAOAction_CallLogTable);
//		intent.addCategory(kDAOCategory_RowRemove);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendContactChangeIntent(String category){
//		Intent intent = new Intent(kDAOAction_ContactsTable);
//		intent.addCategory(category);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//			.sendBroadcast(intent);
//	}
//
//	public static void sendBlockChangeIntent(String category){
//		Intent intent = new Intent(kDAOAction_BlockModel);
//		intent.addCategory(category);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//			.sendBroadcast(intent);
//	}
//
//	public static void sendPermissionChangeIntent(String category){
//		Intent intent = new Intent(kDAOAction_PermissionModel);
//		intent.addCategory(category);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//			.sendBroadcast(intent);
//	}
//	/**
//	 * 发送单条lastseen
//	 * @param category
//	 * @param lastSeenModel
//	 */
//	public static void sendLastSeenModelChangeIntent(String category, LastSeenModel lastSeenModel){
//		Intent intent = new Intent(kDAOAction_LastSeenModel);
//		intent.addCategory(category);
//		intent.putExtra(KEY_MODEL, lastSeenModel);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//
//	public static void sendLastSeenModelChangeIntent(String category, List<LastSeenModel> lastSeenModels){
//		Intent intent = new Intent(kDAOAction_LastSeenModel);
//		intent.addCategory(category);
//		intent.putExtra(KEY_MODEL, (Serializable)lastSeenModels);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendBackgroundImageModelChangeIntent(String category, BackgroundImageModel backgroundImageModel){
//		Intent intent = new Intent(kDAOAction_BackgroundImageModel);
//		intent.addCategory(category);
//		intent.putExtra(KEY_MODEL, backgroundImageModel);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendBackgroundImageModelChangeIntent(String category, List<BackgroundImageModel> backgroundImageModels){
//		Intent intent = new Intent(kDAOAction_BackgroundImageModel);
//		intent.addCategory(category);
//		intent.putExtra(KEY_MODEL, (Serializable) backgroundImageModels);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendFinishInviteGroupIntent(){
//		Intent intent = new Intent(ACTION_FINISH_INVITEGROUPACTIVITY);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendDeleteFavGroupIntent(){
//		Intent intent = new Intent(BConstant.FriendAction.ACTION_DEALGROUP_TO_FAV);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	/**
//	 * 个人信息改变，通知maintab 中的drawer head 更新
//	 */
//	public static void sendSysCallAndSmsChangeIntent(){
//		Intent intent = new Intent(kDAOAction_SystemCallAndSmsModel);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendCallLogStatesChangeIntent(){
//		Intent intent = new Intent(ACTION_CALLLOGSTATE_CHANGED);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendApkDownloadedIntent(){
//		Intent intent = new Intent(ACTION_APK_DOWNLOADED_SUCCESS);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendCocoPublicChangeIntent(String category, PublicAccountModel publicModel) {
//		Intent intent = new Intent(kDAOAction_CocoPublicTable);
//		intent.addCategory(category);
//		if (null != publicModel) {
//			intent.putExtra(KEY_COCOPUBLICMODEL, publicModel);
//		}
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendVersionProgressIntent(DownloadHolder holder, int state){
//		Intent intent = new Intent(ACTION_VERSION_UPDATE_PROGRESS);
//		intent.putExtra(VersionAvailableActivity.DATA_HOLDER,holder);
//		intent.putExtra(VersionAvailableActivity.DATA_STATE,state);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendRecordAudioIntent() {
//		Intent intent = new Intent(ACTION_RECORD_AUDIO);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext()).sendBroadcast(intent);
//	}
//
////	public static void sendCaptureVideoIntent() {
////		Intent intent = new Intent(ACTION_CAPTURE_VIDEO);
////		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
////				.sendBroadcast(intent);
////	}
//
//	public static void sendTakePhotoMessageIntent() {
//		Intent intent = new Intent(ACTION_TAKE_PHOTO_MESSAGE);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendTakeProfilePictureIntent() {
//		Intent intent = new Intent(ACTION_TAKE_PROFILE_PICTURE);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}
//
//	public static void sendTakeChatBackgroundIntent() {
//		Intent intent = new Intent(ACTION_TAKE_CHAT_BACKGROUND);
//		LocalBroadcastManager.getInstance(ApplicationHelper.getContext())
//				.sendBroadcast(intent);
//	}

}
